﻿using System;
using System.Configuration;

namespace FunctionalCLR.Core.Function.Arithmetics {
    public class FpprecNode : FuncNode {

        public string Precision {
            get {
                return ConfigurationManager.AppSettings["Precision"];
            }
            set {
                ConfigurationManager.AppSettings["Precision"] = value.ToString();
            }
        }

        public FpprecNode()
            : base() {
            base.Value = "fpprec";
        }

        public override FuncNode GetReversedFunction(int index) {
            throw new NotImplementedException();
        }

        public override object Evaluate() {
            if (Children.Count > 0) {
                Utils.Precision = Convert.ToInt32(Children[0].Evaluate());
            }

            Console.WriteLine(Utils.Precision);
            return null;
        }
    }
}
